#include #include using namespace std; // // //void getNumbers(int list[], int numbersToGet ) //{ // for(int i = 0; i < numbersToGet;i++) // { // cin >> list[i]; // } //} // //void getRandomNumbers(int list[], int numbersToGet ) //{ // for(int i = 0; i < numbersToGet;i++) // { // list[i] = i; // //list[i] = rand(); // } // list[numbersToGet -1] = 0; // //} // // // template void displayNumbers(T list[], int length ) { for(int i = 0; i < length; i++) { cout << list[i] << endl; } } // //void insertItemAtIndex(int list[], int index, int n, int& gradeCount) //{ // for(int i = gradeCount; i > index; i--) // { // list[i] = list[i - 1]; // } // list[index] = n; // // gradeCount++; //} // //void selectionSort(int* list, int length, bool sortAscending) //{ // for(int i = 0; i < length; i++) // { // int indexOfItemToMove = i; // for(int j = i + 1; j < length; j++) // { // if(sortAscending) // { // if(list[j] < list[indexOfItemToMove]) // { // indexOfItemToMove = j; // } // } // else // { // if(list[j] > list[indexOfItemToMove]) // { // indexOfItemToMove = j; // } // } // } // // swap item at index i with item at index of smallest // int temp = list[i]; // list[i] = list[indexOfItemToMove]; // list[indexOfItemToMove] = temp; // } //} // //void bubbleSort(int list[], int length) //{ // int loopCount = 0; // bool sorted = false; // for(int i = 0; i < length -1 && !sorted;i++) // { // sorted = true; // for(int j = 0; j < length - 1 - i; j++) // { // loopCount++; // if(list[j] > list[j+1]) // { // sorted = false; // int temp = list[j]; // list[j] = list[j+1]; // list[j+1] = temp; // } // } // } // cout << "We looped " << loopCount << " times\n"; //} // // //void reverseList(int list[], int length) //{ // //for(int i = 0; i < length/2; i++) // //{ // // int temp = list[i]; // // list[i] = list[length - i - 1]; // // list[length - i - 1] = temp; // //} // for(int i = 0, j = length-1; i < length/2; i++, j--) // { // int temp = list[i]; // list[i] = list[j]; // list[j] = temp; // } //} // //void removeItemAtIndex(int list[], int index, int& length) //{ // for(int i = index; i < length-1; i++) // { // list[i] = list[i+1]; // } // // // length--; //} // // //void removeDuplicates(int list[], int& length) //{ // for(int i = 0; i < length; i++) // { // //if the element at index i has a duplicate in the list remove it // for(int j = i+1; j > gradeCount; // // cout << endl; // // getNumbers(grades, gradeCount); // //removeItemAtIndex(grades, 2, gradeCount); // //removeDuplicates // cout << endl; // cout << endl; // cout << endl; // // //insertItemAtIndex(grades,20000,777,gradeCount); // //selectionSort(grades,gradeCount, true); // //reverseList(grades,gradeCount); // //bubbleSort(grades, gradeCount); // removeDuplicates(grades,gradeCount); // displayNumbers(grades, gradeCount); // // //cout << grades; //} void getAverages(double assignment1[], double assignment2[], double averages[], int length) { for(int i = 0; i < length; i++) { averages[i] = (assignment1[i] + assignment2[i]) /2.0; } } void main() { //double assignment1[] = {55.6,99.7,77.3,88.4,88,24.3,85}; //double assignment2[] = {65.6,79.7,67.3,98.4,58,104.3,85}; //double averages[7] = {0}; //getAverages(assignment1, assignment2, averages, 7); //displayNumbers(averages, 7); int matrix[4][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}; }